﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ page import="nc.vo.sm.UserVO"%>
<%@ page import="nc.bs.ebvp.login.Constant"%>
<%@ page import="nc.bs.ebvp.sourcingcoll.Constants"%>
<%@ page import="nc.bs.ebvppub.ebvpservicefactory.LoadConfigProperty"%>
<%
	String strMsg = request.getAttribute("ERROR_MESSAGE")==null?"":(String)request.getAttribute("ERROR_MESSAGE");
	String basePath = request.getContextPath();
	String strProjPk = request.getParameter("pkProj");
	if(null == strProjPk || "".equals(strProjPk.trim())){
		strProjPk = ((nc.bs.ebvp.sourcingcoll.form.ProjectForm)request.getAttribute(Constants.ID_PURPROJECT_FORM)).getPk_pur_project();
	}
	String strErrCode = request.getParameter("errCode");
	if("err001".equals(strErrCode)){
		strMsg = "竞价配置单确认验签失败！";
	}
	String strParaEc021 = (String)request.getSession().getAttribute(Constants.ID_EC021);
	UserVO userVo = (UserVO)request.getSession().getAttribute(Constant.USER_INFO);
	boolean isClientCa = false;
	//供应商客户端是否支持CA
	if("Y".equalsIgnoreCase(strParaEc021) || (null != userVo.getIsca() && userVo.getIsca().booleanValue())){
		isClientCa = true;
	}
	//CA厂商名称
	String strCaFactory = (String)request.getSession().getAttribute(LoadConfigProperty.EBVP_CA_FACTORY);
	
%>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>配置单确认</title>
		<%if(isClientCa){%>
			<%if(Constants.CA_FACTORY_ITRUS.equals(strCaFactory)){%>
				<script type="text/javascript" src="js/itrusforNC.js"></script>
				<script type="text/javascript" src="js/pta.js"></script>
			<%} else if(Constants.CA_FACTORY_INFOSEC.equals(strCaFactory)){%>
				<script type="text/javascript" src="js/Infosec4NC.js"></script>
			<%} else if(Constants.CA_FACTORY_DEAN.equals(strCaFactory)){%>
				<script type="text/javascript" src="js/DatechJs.js"></script>
			<%} %>
		<%}%>
	</head>
	<body class="fullbody">
		<div class="context">
			<div class="position">
				<div class="tposi">
					当前位置：
					<a href="<%=basePath%>/infopub/pubmain"	class="linkstyle">首页</a> &nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/projlist" class="linkstyle">我的投标\谈判\询价</a> &nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/biddingprojlist" class="linkstyle">进行中的项目</a> &nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/biddingprojlist/projexec?pk_pur_project=<%=strProjPk%>" class="linkstyle">${PURPROJECT_FORM.project_name}</a> &nbsp;&gt;&gt;&nbsp;
					<span class="curposition">配置单确认</span>
				</div>
				<div class="help">
					<a href="javascript:void(null);" onClick="doHelp('<%=request.getContextPath()%>/help/html/JJPZDQR.html');" class="linkstyle">帮助</a>
				</div>
			</div>
			<div class="margin8">
			</div>
			<div class="subpage_title">
				<div class="title_index">
                     <img src="<%=basePath%>/images/common/dot03.gif" alt="" border="0" />&nbsp;确认配置单
                 </div>
			</div>
			<div class="margin20">
            </div>
			<div class="subpage_bidlist">
				<table width="95%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td width="13">
							<img src="<%=basePath%>/images/reply/yingda_zbj_001.jpg" width="13" height="76"	border="0" />
						</td>
						<td width="70" background="<%=basePath%>/images/reply/yingda_zbj_002.jpg">
							<img src="<%=basePath%>/images/reply/yingda_z_001.jpg" width="64" height="63" border="0" />
						</td>
						<td width="215" valign="top" background="<%=basePath%>/images/reply/yingda_zbj_002.jpg">
							<table width="215" border="0" cellpadding="0" cellspacing="0" height="62">
								<tr>
									<td height="36" colspan="8" valign="middle" class="f-14-e57c00">
										距离应答截止日期还有
									</td>
								</tr>
								<tr>
									<td width="26" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="day">
									</td>
									<td align="center" class="f-14-b-000000">
										天
									</td>
									<td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="hour">
									</td>
									<td align="center" class="f-14-b-000000">
										时
									</td>
									<td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="minute">
									</td>
									<td align="center" class="f-14-b-000000">
										分
									</td>
									<td width="27" align="center" bgcolor="#e57c00" class="f-20-b-ffffff" id="second">
									</td>
									<td align="center" class="f-14-b-000000">
										秒
									</td>
								</tr>
							</table>
						</td>
						<td width="10" align="left" background="<%=basePath%>/images/reply/yingda_zbj_002.jpg">
							<img src="<%=basePath%>/images/reply/yingda_zbj_004.jpg" width="1" height="57" border="0" />
						</td>
						<td background="<%=basePath%>/images/reply/yingda_zbj_002.jpg" class="f-12-F60000">
							注意：请在应答截止时间前进行应答，超过应答截止时间后进行的应答操作为无效操作！
						</td>
						<td width="13">
							<img src="<%=basePath%>/images/reply/yingda_zbj_003.jpg" alt="" width="13" height="76" border="0" />
						</td>
					</tr>
				</table>
				<table class="replytxt" width="95%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td width="128" height="15"></td>
						<td width="176"></td>
						<td width="96"></td>
						<td width="210"></td>
					</tr>
					<tr>
						<td height="35" align="right">
							项目编号：&nbsp;
						</td>
						<td align="left">
							${PURPROJECT_FORM.billno}
						</td>
						<td align="right">
							项目名称：&nbsp;
						</td>
						<td align="left">
							${PURPROJECT_FORM.project_name}
						</td>
					</tr>
					<tr>
						<td height="35" align="right">
							确认开始时间：&nbsp;
						</td>
						<td align="left">
							${ONLINEQUOTE_FORM.cfmset_start_time}
						</td>
						<td align="right">
							确认结束时间：&nbsp;
						</td>
						<td align="left">
							${ONLINEQUOTE_FORM.cfmset_end_time}
						</td>
					</tr>
					<tr>
						<td>&nbsp;
							
						</td>
					</tr>
				</table>
				<table width="95%" border="0" cellpadding="0" cellspacing="0" class="releasefile">
					<form action="" method="post" name="replyform">
					<input type="hidden" name="casn" value=""/>
					<input type="hidden" name="signature" value=""/>
					<input type="hidden" name="pk_pur_project" value="${ONLINEQUOTE_FORM.pk_pur_project}"/>
					<input type="hidden" name="pk_purproj_step" value="${ONLINEQUOTE_FORM.pk_purproj_step}"/>
					<input type="hidden" name="pk_onlinequote_h" value="${ONLINEQUOTE_FORM.pk_onlinequote_h}"/>
					<input type="hidden" name="pk_quotesupp_b" value="${QUOTESUPP_PK}"/>
					<tr>
						<td width="113" height="28" align="left">
							<span class="filelabel">报价单元</span>
						</td>
						<td width="197" align="center">&nbsp;
							
						</td>
						<td width="113" align="center">&nbsp;
							
						</td>
						<td width="187" align="center">&nbsp;
							
						</td>
					</tr>
					
					<tr>
						<td height="35" colspan="4" align="left">
							<table cellpadding="0" cellspacing="0" class="tableCss">
								<tr class="titleTr">
									<th width="35px">序号</th>
									<th width="245px">报价单元</th>
									<th width="56px">产品项</th>
									<th width="464px">备注</th>
								</tr>
								<c:forEach items="${PRICE_FORM}" var="price">
									<c:if test="${price.index%2==1}">
										<tr align="left" class="contTr-old"  >
									</c:if>
									<c:if test="${price.index%2==0}">
										<tr align="left" class="contTr-even">
									</c:if>
										<td class="td3">${price.index}</td>
										<td class="td3">${price.price_unit}</td>
										<td class="td3">
										<c:if test="${price.is_prod_item == 'Y' || price.is_prod_item == 'y'}">是</c:if>
										<c:if test="${price.is_prod_item == 'N' || price.is_prod_item == 'n'}">否</c:if>
										</td>
										<td class="td3">${price.memo}</td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
					
					<c:if test="${ONLINEQUOTE_FORM.pricetplt_type == '1'}">
						<tr>
							<td width="70%" height="28" align="left">
								<span class="filelabel">报价明细</span>
							</td>
							<td width="10%" align="center">&nbsp;
								
							</td>
							<td width="10%" align="center">&nbsp;
								
							</td>
							<td width="10%" align="right">
							</td>
						</tr>
						<tr>
							<td height="35" colspan="4" align="left">
								<table cellpadding="0" cellspacing="0" class="tableCss">
									<tr class="titleTr">
										<th width="35px">序号</th>
										<th width="122px">产品</th>
										<th width="102px">规格</th>
										<th width="102px">型号</th>
										<th width="180px">产品描述</th>
										<th width="153px">配置说明</th>
										<th width="106px">数量</th>
									</tr>
								</table>
								
								
								
								<table id="prodTable" cellpadding="0" cellspacing="0" class="tableCss">
									<c:forEach items="${PRICE_DETAIL_FORM}" var="pricedetail">
										<c:if test="${pricedetail.detail_index%2==1}">
											<tr align="left" class="contTr-old"  >
										</c:if>
										<c:if test="${pricedetail.detail_index%2==0}">
											<tr align="left" class="contTr-even">
										</c:if>
											<td width="35px"class="td3">${pricedetail.detail_index}</td>
											<td width="122px"class="td3">
											<span class="prodName">
											<c:if test="${pricedetail.prod_name != null && '' !=pricedetail.prod_name}">													
											${pricedetail.prod_name}
											</c:if>
											<c:if test="${pricedetail.prod_name == null || '' ==pricedetail.prod_name}">													
											${pricedetail.config_note}
											</c:if>
											</span><br/>
											</td>
											<td width="102px"class="td3">
											<c:if test="${pricedetail.prod_spec!=null && ''!=pricedetail.prod_spec}">${pricedetail.prod_spec}<br/></c:if>
											</td>
											<td width="102px"class="td3">
											<c:if test="${pricedetail.prod_type!=null && ''!=pricedetail.prod_type}">${pricedetail.prod_type}<br/></c:if>
											</td>
											<td width="180px"class="td3">
											<c:if test="${pricedetail.producer!=null && ''!=pricedetail.producer}">生产厂商：${pricedetail.producer}<br/></c:if>
											<c:if test="${pricedetail.asistantproperty!=null && ''!=pricedetail.asistantproperty}">描述：${pricedetail.asistantproperty}<br/></c:if>
											</td>
											<td width="153px"class="td3">
											${pricedetail.config_note}
											</td>
											<td width="106px"class="td3">
											<input type="hidden" name="amount_precision" value="${pricedetail.amount_precision}" />
											<input name="amount" class="input-unEdit words-blue" type="text" value="${pricedetail.amount}" readonly />
											${pricedetail.prod_unit_name}
											</td>
										</tr>
									</c:forEach>
								</table>
								<p class="protext" id="div_content" name="div_content">
									<br />
								</p>
							</td>
						</tr>
					</c:if>
					<tr>
						<td colspan="2" align="left" valign="top">
							说明：<input name="confirm_note" type="text" class="cfm_tplt_reason" value="${ONLINEQUOTE_FORM.confirm_note}" />
							<div class="margin20">
            				</div>							
						</td>
					</tr>
					
					<tr>
						<td colspan="4" align="right" valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<td width="50%" height="28" align="left" style="font-size: 12px;">
									<span>确认人：</span>
									<span>${ONLINEQUOTE_FORM.tplt_cfm_psn}</span>
								</td>
								<td width="50%" height="28" align="left" style="font-size: 12px;">
									<span>确认时间：</span>
									<span>${ONLINEQUOTE_FORM.tplt_cfm_time}</span>
								</td>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="left" valign="top">
							<div id="errorM" class="msgcolor">
								<c:out value="<%=strMsg%>"></c:out>
							</div>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="right" valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<td width="113" height="40" align="left">
									
								</td>
								<td width="197" align="right">
									<input type="button" class="buttonok" value="接受" onClick="doReply(1);" />
								</td>
								<td width="113" align="center">
									<input type="button" class="buttonok" value="拒绝" onClick="doReply(2);" />
								</td>
								<td width="187" align="center">&nbsp;
									
								</td>
							</table>
						</td>
					</tr>
					</form>
				</table>		
			</div>
		</div>
		<script language="javascript">
			//设置时间控制对象
			var change  = new timechange();
			//设置时间长度
			change.setDistance(${DISMILL});
			//唤醒计算时间的方法
			wakeInterval();
			//提交响应信息
			function doReply(flag){
				if("${DISMILL}" == "0"){
					alert("已过期限或已接受、已拒绝！");
					return;
				}
				<%if(isClientCa){%>
					//证书SN
					var strSn = getSN("${USER_CODE}");
					if(strSn == null || strSn == ""){
						alert("请插入Key后再进行操作！");
						return;
					}
					document.replyform.casn.value = strSn;
					//方案主键|发布类单据主键|供应商对应用户主键
					var strSignData = "${ONLINEQUOTE_FORM.pk_onlinequote_h}" + "|" + "${USER_ID}";
					//签名
					document.replyform.signature.value = signmessage(strSignData,"${USER_CODE}");
				<%}%>
				document.replyform.action = "<%=basePath%>/sourcing/biddingprojlist/confirmtplt?flag="+flag;
				document.replyform.submit();
			}
			//设置显示值
			//合计金额
			var totalAmount = document.getElementsByName("total_amount");
			if(null != totalAmount){
				for(var i=0;i<totalAmount.length;i++){
					subReduNum(totalAmount[i],'${MONEY_PRECISION}');
				}
			}
			//数量
			var amount = document.getElementsByName("amount");
			var amountPrecision = document.getElementsByName("amount_precision");
			if(null != amount){
				for(var i=0;i<amount.length;i++){
					subReduNum(amount[i],amountPrecision[i].value);
				}
			}
			//含税单价
			var hasTaxPrice = document.getElementsByName("has_tax_price");
			if(null != hasTaxPrice){
				for(var i=0;i<hasTaxPrice.length;i++){
					subReduNum(hasTaxPrice[i],'${PRICE_PRECISION}');
				}
			}
			//税率
			var taxRate = document.getElementsByName("tax_rate");
			if(null != taxRate){
				for(var i=0;i<taxRate.length;i++){
					subReduNum(taxRate[i],2);
				}
			}
			//折扣率
			var detailDiscount = document.getElementsByName("detail_discount");
			if(null != detailDiscount){
				for(var i=0;i<detailDiscount.length;i++){
					subReduNum(detailDiscount[i],2);
				}
			}
			//折后价（含税净价或者无税竞价，统一取含税净价）
			var hasTaxNetPrices = document.getElementsByName("discount_net_price");
			if(null != hasTaxNetPrices){
				for(var i=0;i<hasTaxNetPrices.length;i++){
					subReduNum(hasTaxNetPrices[i],'${PRICE_PRECISION}');
				}
			}
			//折后金额（价税合计）
			var priceTaxSums = document.getElementsByName("discount_net_sum");
			if(null != priceTaxSums){
				for(var i=0;i<priceTaxSums.length;i++){
					subReduNum(priceTaxSums[i],'${MONEY_PRECISION}');
				}
			}
		</script>
	</body>
</html>
